import { IValid } from "../interfaces";

/**
 * 自定义的资源分类，对应各个引擎中相同的资源。
 */
export enum ResType {
    NULL,
    Texture2D,
    SpriteFrame,
    SpriteAtlas,
    Prefab,
    Json,
    Scene,
    Material,
    AnimationClip,
    Mesh,
    Particle2D,//粒子效果
    AudioClip,
    AssetBundle,
    Remote,
    Scene3D,
    Sprite3D,
    Director,//整个目录
    Spine,
    ImageAsset,
    EffectAsset,
    ParticleAsset
}
export type ResCallback = (err: any, res: any) => void
export enum ResMgrTypeEnum {
    REF_COUNT,//使用引用计数方式管理资源
    MARK,//使用标记方法管理资源
}

export interface IResItem {
    getRes(): any;
    addCount(): void;
    subCount(): void;
    getUrl(): string;
    getType(): ResType;
}
export type LoadParam = {
    url: string,
    type: ResType,
    bundle?: string,
    target: IValid,
    callback: (err: any, item: IResItem) => void,
    onProgress?: (count: number, total: number) => void,
}

export type LoadArrayParam = {
    list: string[],
    type: ResType,
    bundle?: string,
    target: IValid,
    callback: (err: any) => void,
    onProgress?: (count: number, total: number) => void,
}
